package org.springboot.demo.controller;

import org.springboot.demo.domain.City;
import org.springboot.demo.framework.mongo.CityMongoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Mongo的视图控制类
 * Created by Robin on 2017/7/13.
 */
public class CityMongoController {

    @Autowired
    private CityMongoRepository cityMongoRepository;

    /*@RequestMapping("/mongo/save")
    public String save(){

        City city = new City();
        city.setId(100);
        city.setCityName("Beijing");
        city.setDescription("Beijing is One!");
        cityMongoRepository.save(city);

        city.setId(200);
        city.setCityName("Shanghai");
        city.setDescription("Shanghai is Two!");
        cityMongoRepository.save(city);
        return "ok";

    }

    @RequestMapping("/mongo/find")
    public List<City> find(){
        return cityMongoRepository.findAll();
    }*/


}
